package com.itheima.day02.demo2;

public class Test {
    public static void main(String[] args) {
        Appliance a = new TV();
        a.close();
        a.open();
        if (a instanceof Refrigerator) {
            Refrigerator r = (Refrigerator) a;
            r.dong();
        }
        if (a instanceof TV) {
            TV tv = (TV) a;
            tv.kan();
        }
        Appliance a1 = new Refrigerator();
        a1.close();
        a1.open();
        if (a1 instanceof Refrigerator) {
            Refrigerator r = (Refrigerator) a1;
            r.dong();
        }
        if (a1 instanceof TV) {
            TV tv = (TV) a1;
            tv.kan();
        }
    }
}
